<?php

declare(strict_types=1);

namespace App\Mall\Model;

use App\Fastapp\Model\FastappCategory;
use Hyperf\Database\Model\Relations\HasOne;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property int $goods_id 
 * @property int $category_id 
 * @property-read null|FastappCategory $category 
 */
class MallGoodsCategory extends MineModel
{
    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'mall_goods_category';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'goods_id', 'category_id'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'goods_id' => 'integer', 'category_id' => 'integer'];

    public function category(): HasOne
    {
        return $this->hasOne(FastappCategory::class, 'id', 'category_id');
    }
}
